home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Processes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  6.0 KB  |  222 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Processes.h
  3.  
  4.      Contains:    Process Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1989-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __PROCESSES__
  19. #define __PROCESSES__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __EVENTS__
  25. #include <Events.h>
  26. #endif
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. /* type for unique process identifier */
  54. struct ProcessSerialNumber {
  55.     unsigned long                     highLongOfPSN;
  56.     unsigned long                     lowLongOfPSN;
  57. };
  58. typedef struct ProcessSerialNumber ProcessSerialNumber;
  59.  
  60. typedef ProcessSerialNumber *            ProcessSerialNumberPtr;
  61.  
  62. enum {
  63.                                                                 /* Process identifier - Various reserved process serial numbers */
  64.     kNoProcess                    = 0,
  65.     kSystemProcess                = 1,
  66.     kCurrentProcess                = 2
  67. };
  68.  
  69. /* Definition of the parameter block passed to _Launch */
  70. /* Typedef and flags for launchControlFlags field*/
  71. typedef unsigned short                     LaunchFlags;
  72.  
  73. enum {
  74.     launchContinue                = 0x4000,
  75.     launchNoFileFlags            = 0x0800,
  76.     launchUseMinimum            = 0x0400,
  77.     launchDontSwitch            = 0x0200,
  78.     launchAllow24Bit            = 0x0100,
  79.     launchInhibitDaemon            = 0x0080
  80. };
  81.  
  82. /* Format for first AppleEvent to pass to new process.  The size of the overall
  83.   buffer variable: the message body immediately follows the messageLength */
  84. struct AppParameters {
  85.     EventRecord                     theMsgEvent;
  86.     unsigned long                     eventRefCon;
  87.     unsigned long                     messageLength;
  88. };
  89. typedef struct AppParameters AppParameters;
  90.  
  91. typedef AppParameters *                    AppParametersPtr;
  92. /* Parameter block to _Launch */
  93. struct LaunchParamBlockRec {
  94.     unsigned long                     reserved1;
  95.     unsigned short                     reserved2;
  96.     unsigned short                     launchBlockID;
  97.     unsigned long                     launchEPBLength;
  98.     unsigned short                     launchFileFlags;
  99.     LaunchFlags                     launchControlFlags;
  100.     FSSpecPtr                         launchAppSpec;
  101.     ProcessSerialNumber             launchProcessSN;
  102.     unsigned long                     launchPreferredSize;
  103.     unsigned long                     launchMinimumSize;
  104.     unsigned long                     launchAvailableSize;
  105.     AppParametersPtr                 launchAppParameters;
  106. };
  107. typedef struct LaunchParamBlockRec LaunchParamBlockRec;
  108.  
  109. typedef LaunchParamBlockRec *            LaunchPBPtr;
  110. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  111.  Set launchEPBLength to extendedBlockLen for compatibility.*/
  112.  
  113. enum {
  114.     extendedBlock                = 0x4C43,                        /* 'LC' */
  115.     extendedBlockLen            = sizeof(LaunchParamBlockRec) - 12
  116. };
  117.  
  118.  
  119. enum {
  120.                                                                 /* Definition of the information block returned by GetProcessInformation */
  121.     modeLaunchDontSwitch        = 0x00040000,
  122.     modeDeskAccessory            = 0x00020000,
  123.     modeMultiLaunch                = 0x00010000,
  124.     modeNeedSuspendResume        = 0x00004000,
  125.     modeCanBackground            = 0x00001000,
  126.     modeDoesActivateOnFGSwitch    = 0x00000800,
  127.     modeOnlyBackground            = 0x00000400,
  128.     modeGetFrontClicks            = 0x00000200,
  129.     modeGetAppDiedMsg            = 0x00000100,
  130.     mode32BitCompatible            = 0x00000080,
  131.     modeHighLevelEventAware        = 0x00000040,
  132.     modeLocalAndRemoteHLEvents    = 0x00000020,
  133.     modeStationeryAware            = 0x00000010,
  134.     modeUseTextEditServices        = 0x00000008,
  135.     modeDisplayManagerAware        = 0x00000004
  136. };
  137.  
  138. /* Record returned by GetProcessInformation */
  139. struct ProcessInfoRec {
  140.     unsigned long                     processInfoLength;
  141.     StringPtr                         processName;
  142.     ProcessSerialNumber             processNumber;
  143.     unsigned long                     processType;
  144.     OSType                             processSignature;
  145.     unsigned long                     processMode;
  146.     Ptr                             processLocation;
  147.     unsigned long                     processSize;
  148.     unsigned long                     processFreeMem;
  149.     ProcessSerialNumber             processLauncher;
  150.     unsigned long                     processLaunchDate;
  151.     unsigned long                     processActiveTime;
  152.     FSSpecPtr                         processAppSpec;
  153. };
  154. typedef struct ProcessInfoRec ProcessInfoRec;
  155.  
  156. typedef ProcessInfoRec *                ProcessInfoRecPtr;
  157.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  158.                                                                                             #pragma parameter __D0 LaunchApplication(__A0)
  159.                                                                                             #endif
  160. EXTERN_API( OSErr )
  161. LaunchApplication                (LaunchPBPtr             LaunchParams)                        ONEWORDINLINE(0xA9F2);
  162.  
  163. EXTERN_API( OSErr )
  164. LaunchDeskAccessory                (const FSSpec *            pFileSpec,
  165.                                  ConstStr255Param         pDAName)                            THREEWORDINLINE(0x3F3C, 0x0036, 0xA88F);
  166.  
  167. EXTERN_API( OSErr )
  168. GetCurrentProcess                (ProcessSerialNumber *    PSN)                                THREEWORDINLINE(0x3F3C, 0x0037, 0xA88F);
  169.  
  170. EXTERN_API( OSErr )
  171. GetFrontProcess                    (ProcessSerialNumber *    PSN)                                FIVEWORDINLINE(0x70FF, 0x2F00, 0x3F3C, 0x0039, 0xA88F);
  172.  
  173. EXTERN_API( OSErr )
  174. GetNextProcess                    (ProcessSerialNumber *    PSN)                                THREEWORDINLINE(0x3F3C, 0x0038, 0xA88F);
  175.  
  176. EXTERN_API( OSErr )
  177. GetProcessInformation            (const ProcessSerialNumber * PSN,
  178.                                  ProcessInfoRec *        info)                                THREEWORDINLINE(0x3F3C, 0x003A, 0xA88F);
  179.  
  180. EXTERN_API( OSErr )
  181. SetFrontProcess                    (const ProcessSerialNumber * PSN)                            THREEWORDINLINE(0x3F3C, 0x003B, 0xA88F);
  182.  
  183. EXTERN_API( OSErr )
  184. WakeUpProcess                    (const ProcessSerialNumber * PSN)                            THREEWORDINLINE(0x3F3C, 0x003C, 0xA88F);
  185.  
  186. EXTERN_API( OSErr )
  187. SameProcess                        (const ProcessSerialNumber * PSN1,
  188.                                  const ProcessSerialNumber * PSN2,
  189.                                  Boolean *                result)                                THREEWORDINLINE(0x3F3C, 0x003D, 0xA88F);
  190.  
  191. #if !OLDROUTINELOCATIONS
  192. /*
  193.     ExitToShell was previously in SegLoad.h
  194. */
  195. EXTERN_API( void )
  196. ExitToShell                        (void)                                                        ONEWORDINLINE(0xA9F4);
  197.  
  198. #endif  /*  !OLDROUTINELOCATIONS */
  199.  
  200.  
  201.  
  202. #if PRAGMA_STRUCT_ALIGN
  203.     #pragma options align=reset
  204. #elif PRAGMA_STRUCT_PACKPUSH
  205.     #pragma pack(pop)
  206. #elif PRAGMA_STRUCT_PACK
  207.     #pragma pack()
  208. #endif
  209.  
  210. #ifdef PRAGMA_IMPORT_OFF
  211. #pragma import off
  212. #elif PRAGMA_IMPORT
  213. #pragma import reset
  214. #endif
  215.  
  216. #ifdef __cplusplus
  217. }
  218. #endif
  219.  
  220. #endif /* __PROCESSES__ */
  221.  
  222.